package com.huanxing.cloud.upms.api.feign;

import com.huanxing.cloud.common.core.constant.SecurityConstants;
import com.huanxing.cloud.common.core.constant.ServiceNameConstants;
import com.huanxing.cloud.common.core.util.Result;
import com.huanxing.cloud.upms.api.dto.SysUserReqDTO;
import com.huanxing.cloud.upms.api.entity.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 系统用户 feign
 *
 * @author lijx
 * @date 2022/6/28
 */
@FeignClient(contextId = "remoteSysUserService", value = ServiceNameConstants.UMPS_SERVICE)
public interface RemoteSysUserService {

	/**
	 * 通过用户名查询用户、角色信息
	 *
	 * @author lijx
	 * @date 2022/6/28
	 * @param username
	 * @param source
	 * @return: com.huanxing.cloud.common.core.util.Result<com.huanxing.cloud.upms.common.entity.SysUser>
	 */
	@GetMapping("/user/info/{username}")
	Result<SysUser> getUserInfo(@PathVariable("username") String username,
			@RequestHeader(SecurityConstants.SOURCE) String source);

	/**
	 * 通过手机号查询用户、角色信息
	 *
	 * @author lijx
	 * @date 2022/7/5
	 * @param phone
	 * @param source
	 * @return: com.huanxing.cloud.common.core.util.Result<com.huanxing.cloud.upms.common.entity.SysUser>
	 */
	@GetMapping("/user/phone/info/{phone}")
	Result<SysUser> getUserInfoByPhone(@PathVariable("phone") String phone,
			@RequestHeader(SecurityConstants.SOURCE) String source);

	/**
	 * 创建系统用户
	 * @param sysUserReqDTO
	 * @param source
	 * @return
	 */
	@PostMapping("/user/create-user")
	Result<Boolean> createUser(@RequestBody SysUserReqDTO sysUserReqDTO,
			@RequestHeader(SecurityConstants.SOURCE) String source);

}
